/* Check JER_Bitmatrix_Encode(). */
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include "reed_sol-2.h"
#include "jerasure-2.h"
#include "galois-2.h"

using namespace std;

int main( int argc, char** argv )
{
	JER_Matrix *jm;
	JER_Bitmatrix *jbm2;
	JER_Matrix *jm2;
	JER_Matrix* jm3;
	JER_Slices *slices;
	int i, j;

	int m = atoi( argv[1] );
	int k = atoi( argv[2] );
	int w = atoi( argv[3] );
	unsigned char* buffer;
	int fsize;

	srand48(m);

	fsize = 1 << w;
	jm = new JER_Matrix( m, k, w );
	jm2 = new JER_Matrix( k, m, w );
	for( i = 0; i < m*k; i++ )
	{
		jm->Elts[i/k][i%k] = lrand48() % fsize;
		jm2->Elts[i/m][i%m] = lrand48() % fsize;
	}

	jm3 = JER_Matrix_Multiply( jm, jm2 );

	jm3->Print();
	return 0;
}
